<template>
  <div>
    <el-row :gutter="20">
      <el-col :span="2"><div >订单编号</div></el-col>
      <el-col :span="2"><div >病人姓名</div></el-col>
      <el-col :span="2"><div >病人性别</div></el-col>
      <el-col :span="2"><div >病人年龄</div></el-col>
      <el-col :span="3"><div >图片</div></el-col>
      <el-col :span="6"><div >病症描述</div></el-col>
      <el-col :span="6"><div >病症回复</div></el-col>
    </el-row>
    <hr>
    <div class="wrap_item" v-for="order in orinfo" v-if="order.status=='2'">
      <el-row :gutter="20">
        <el-col :span="2"><div >{{order.id}}</div></el-col>
        <el-col :span="2"><div >{{order.patientname}}</div></el-col>
        <el-col :span="2"><div >{{order.sex}}</div></el-col>
        <el-col :span="2"><div >{{order.birthday}}</div></el-col>
        <el-col :span="3"><a :href="order.picture">点击预览</a></el-col>
        <el-col :span="6"><div >{{order.symptom}}</div></el-col>
        <el-col :span="6"><div >{{order.diagnosis}}</div></el-col>
        <!--<el-col :span="6"><div><el-button type="text" @click="toDetail(order.id)">回复</el-button>-->
          <!--<el-dialog title="医生回复" :visible.sync="dialogFormVisible" width="450px">-->
            <!--<el-form :model="form">-->
              <!--<el-form-item label="回复" :label-width="formLabelWidth">-->
                <!--<el-input v-model="form.name"-->
                          <!--type="textarea"-->
                          <!--:rows="2"-->
                          <!--autocomplete="off"></el-input>-->
              <!--</el-form-item>-->
            <!--</el-form>-->
            <!--<div slot="footer" class="dialog-footer">-->
              <!--<el-button @click="dialogFormVisible = false">取 消</el-button>-->
              <!--<el-button type="primary" @click="firstclick" >确 定</el-button>-->
            <!--</div>-->
          <!--</el-dialog></div></el-col>-->
      </el-row>
      <hr>
    </div>
  </div>
</template>

<script>
  export default {
    name: "forms",
    data() {
      return{
        orinfo:[],
        dialogTableVisible: false,
        dialogFormVisible: false,
        form: {
          name: '',
          region: '',
          date1: '',
          date2: '',
          delivery: false,
          type: [],
          resource: '',
          desc: ''
        },
        formLabelWidth: '80px'
      }
    },
    methods: {
      getList: function () {
        var  user = localStorage.getItem('User')
        console.log(user)
        this.$ajax.get('http://47.75.110.31:8080/orinfo/findByDoctor?doctor='+user)
          .then(response => {
            this.orinfo = response.data;
          })
      },
      toDetail (orderid) {
        this.dialogFormVisible = true;
        localStorage.setItem("orderid",orderid);
        console.log(orderid);
      },
      firstclick (){
        var orderid = localStorage.getItem("orderid");
        console.log(orderid);
        this.$ajax.post('http://47.75.110.31:8080/orinfo/updatestatus?status=2&id='+orderid,
          {

            headers: {
              'Content-Type': 'application/json;charset=UTF-8'
            }
          }
        ).then(response => {
          this.$ajax.post('http://47.75.110.31:8080/orinfo/updatere?id='+orderid+'&diagnosis='+this.form.name,
            {

              headers: {
                'Content-Type': 'application/json;charset=UTF-8'
              }
            }
          ).then(response => {
            console.log(response.data);
            if (response.data == "success") {
              this.$message({
                message: '恭喜你添加成功',
                type: 'success'
              });
            }
            location.reload();
          })
        })
        this.dialogFormVisible = false;
      }
    },
    mounted () {
      this.getList()
    }
  }

</script>

<style scoped>

</style>
